debug and coding style tweaks