Improved javascript layout performance