Error handling

Added tests for client and server models, and for routes. Made several fixes and adapted interfaces for basic error handling.