cleanup and a bug fix
resolved merge conflict