changed max port to 7
code cleanup