Refactored into OO, tabs added