Added tests and more informative messages