added input checks