moved relevant code from js Application controller to TextMessage MVC structure