Portal processing implementation (not tested yet), direction and positioning refactoring