Search the board for KSMS - it may do everything you need, and if not it will at least give you some ideas how to get started.