More refactoring and data pulling functional