small changes. Renamed some variables