Refactored to remove dead code