Remove duplicate return statement and deprecated function