Ammended some of the logic. Running out of time tonight, will continue tomorrow.