Refactored contoller, added deletion of pages