Attempt at a merge

My not-so-fabulous attempt at merging the two programs.