code clean-up
peak cpu usage needs to be reduced