implemented tablesorter, reorganized code