#121 integrated changes due to comments from Andreas