Fixing effed up code