refactored and fixed plugin processing + added port setting