Fixed toThrow so it doesn't always pass, and added check to make sure value is a function