incorporated feedback; added tests; minor changes in exception msgs