These three blocks are almost identical. Do not repeat yourself.