BPM-29

some refactoring