Refactor code that is relevant to storing scan results