Add few assertions in the code, minor changes