Needs to be refactored for callbacks