Improved CPU usage (Kaslai)

I attempted to merge this earlier but there was conflict. Considering
the change is like 5 lines I just added it myself. The original pull
request came from @Kaslai