Remove unused code

Just spotted a function that was being declared twice (in nested scopes). So I have removed the one in the outer scope as it was never getting called (and its job is already being done by the other one).