removes extra rows and global js functions