Refactor/bpm variable code cleanup