Absorbed of Lydia's code into the main program

Adds new functions and resolves two tickets. Also includes back up files
to just copy the code directly into a working IDE.