Please better describe what the method does, see example for `cutOutMessages`. Describe input arguments, describe return value. Time complexity is not that important here, leave it out.