refactored and added flag functionality
removed files