refactored majority of the code to non-static classes