fixes

improved some things and renamed some confusing variables