Refactored createCS-callback for testability