merge with heiko + adjustments for changes since his branch