removed unnecessary ports; timing optimizations; code clean up