Move some complexity to commit class.