Rewritten after decision to move to a custom solution

re #6174
Rewritten after moving to custom solution

re #6174