Begin switch to coffeescript and restructure

refactoring code along side change to coffeescript