Removed useless function and renamed a variable