moved printMsg to top