added basic input checking