Refactored repeated positioning logic