added some validation and tests