fixed port building from settings
lots of refactor