It is unfortunate that these two blocks of code are repeated.