Changed names and place of ports. Changed order of assignments in code. Removed trailing whitespace.