Refactored so that it's like a class and shit.