refactored callbacks to avoid extra SQL