Initial working version. Feature incomplete.