added some sanity checks on input arguments in all public methods