clean up the code & add comments re port