added lots of functionality, saved state, moved to MVC