refactorings and added initial monitoring support