removed unnecessary code, made variables more clear