Some changes fixing half of the problems in #102