adapted all functions for callbacks