Cleanup unused code
Minor refactoring