Added simple main loop with signal handlers

This is for #46.