Finished code.
Resolved merge conflict.