Refactored code to be more distributed and centrally accessible.