type checking added
type checking tested