clean some unnecessary code and add authentication to some pages