Stuff I had to code for the Prologin contest