Renamed some variables and changed some types