refactorying master port to be immutable, and fixed a few unneeded things
removed dead code
making ports immutable
documentation