Removed obsolete methods
Refactored code to removed duplicate code
Moved flag admin stuff to separate template and class.