move encoding up, use more input events, move table stuff to CSS