Adding solution. Partially functional. Lots of errors though.
Working through things ... trying a debugger...