Added simulator
Added simulator
Refactored out application specific code