Add profiling and Ctrl-C handling
Add code suggestions from @nictuku
Merge pull request #22 from rakoo/profiling-ctrlc

Add profiling and Ctrl-C handling