Remove redundant function, correct variable error