added some tests + better error messages