Prototype code. First commit, nothing tested. Some interfaces, extensions written.