Code refactor

incorporating object oriented programming. work in progress.