Variable name fixes, code formatting