Updated print function to take message argument