fixed some minor tweaks & Optimize messages table