WIP Cartridge Refactor

* Added application_state.rb and environ.rb plus unit tests
* Added README.writing_applications.md