resolved merge conflict and cleaned up the code