Add initial code. Pretty rough but working and feature-complete.