unabbreviate some variables, reorder some code