On-going performance tweaks. Code is a mess.