Improved performance and fixed vertical align bug