Infrastructure.
Logic done, still ugly.