Extracted Popping Logic in methods some changes in position

Popping Logic extracted in methods in order to increase code reusability
and maintainability
Some changes in Position Struct in order to make that possible, added
direction constants