renamed vars, removed unused code