Create angular controllers and factories to modularize front end.
Move timeout logic to server.