reorganising code a bit ...