Added sanity checks of input parameters