Lots of changes. One error remains: #2