debug messages and minor changes in return types etc