[modified] Refactored show toast message function.
[modified] Refactored thread to use less copy&paste.