Refactored functions; broke some core functions