made validation better