Further restructuring, some minor fixes