Refactorized code
Resolved merge conflicts