removed n+1 queries
refactored app into multiple files