added type checking for parameter