added exception handling, updated client