Tidying up duplicate code.