splitting up handlers and server logic
tweaking error message