added callbacks, re-arranged them