add dump function; use decorators for callbacks