code fixes, removed test stuff, added server error handling