First version. Not fully working.
Resolved merge.