Change collapsing method to not use JS.