Create function for debug messages, fixes #3