Added admin page and refactored some code