moved the previousemote logic outside of a few conditions