Finished lab. TODO: remove debugging print statements, comment, test on larger files