added tests and negative cases