Refactored data storage and rewrote the input/output of results