Refactoring code & added some html elements