adding some better error messages and a few more features