how to fix inefficient operations