Added basic main loop