Removed unused variables from check function