refactored handler functions to send data in consistent format