this can be shortened to head != null