starting to restructure code.