Made some tweaks, optimized a bit.