Refactoring: Moved code into LocationUtil and GateUtil.
Fixed Issue #8