Adjusted code to work for the competition

This still needs to be tested IRL.