Added assertions for input checking