restructured the views and cleaned the code