Restrctured app.coffee