Remove unused function and redundant do