REFACTOR - cleaned up code