Major restructuring in NeuronWriter

Latest changes from dev manually merged, so this version can safely replace the one in dev.