Separated procedural code into OO