refactoring the views and reformatting the code