added more validations and corresponding tests