Move function documentation; cleanup variable names