added end marker
modified to have proper end message
modified so that never gets twice in a row the same number