add input checking and exception classes