Moved some variables around; fixed several violations.