work for the first three cases