Restructure of code for modularity, rewrite of code to reflect new working openCV.