This logic could be extracted to separate method