Cleaned code (warnings etc)

Fixes #1098 #1099 #1108
This comment should be updated to refer to sampling_procedure.sample, not deleted.