fixed cpu usage. ready to merge