Refactored - cleaned source