perhaps extract this to a method that can be called from line 77 too.