main() and callbacks