Actually fixed the crappy code