improve variable naming and comments