Separate header and cpp files for each major function

for easier organization later