Currently functioning - good save point before working on transfering to...

... using objects and higher level functions.