Add missing return statement, remove unused variable