Initial code, but already almost features-complete