Made code more OOP-ish.