Rushed, terribly written code, uploaded for reference.