implement server exception handling and cleaned up white space