Big refactoring. RkNNTestEnvironment now much less code