Debug simplify

Some minor code improvements. Please look over @btovar.