Added some parameter checks.