Fixed all of Mathias' crappy code ;). Nah, it's still crappy, but works now