Fixed bug with message[1] and array checking. There must be a more elegant way to write it.