Minor code cleanup
Some more refactoring to clean up the fragment