Removed debug option in functions
Dyamically allocate ports and write logs to file
Merged dynamic ports branch