Dirname typecheck

Added parameter type checking, a check for too many parameters, and tests for all.