Move this pattern to utils