This block is repeated in multiple places, do not repeat yourself.