some variables have been refactored