code clean up; format fixes