Moved filtering logic and table generation to Javascript.