Could you refactor this a bit to merge the if and the elif so we don't have the same messages twice?