added test, moved errors to seperate file