added basic input validation