moved most variables into separate global class