EQ-1444 Code cleanup and performance improvement