Added initial code. WIP
Added some comments and cleanup.