Fix #7 + minor improvements