Removed old code
Did some slight refactoring