generalised and switched to json configuration