Adding some basic validation and throwing an exception when it's not met