wrote ternary trying to add validation