Intermediate save point. Combined several files and added more testing functions.