Changed implementation to use OOP :(.