Changed sprintf to snprintf (unix)
Added generic print_message() function for future use (unix)