Massive cleanup and code verification to improve UI response