(added) controller validation, error handling and basic input checking