final, camargo3, removed dead code and added comments