added test and refactored homepage view