Refactored html and controllers