1. Added test cases in functional test and 2. Refactored the code to use template for rendering html