Replacing procedural with object oriented style