MDL-15310: moving capability checks out of the library + code formatting adjustments