Add refactored code from FlexDB module
Merge branch 'develop'