First commit of the majority of the logic