renamed some variables to be more sane