Refactor various views to use data from db.
Fix white space.
Move promise handler into the factory.