Added assertions to check input