Added in some validation and checks