Adding textwrite library and restructuring the application with requirejs