Fixed the buggy collapse('toggle') call, and minor cleanup