modified gem file
added tests, fixed error codes