refactored to save old logic and clean up code in new project with fragments