Wrote the worst thing ever

This code must be replaced quickly, commiting in case there's something worth
salvaging.