Object-orienting the code