Added exceptions and value checks