adding some sanity to the code