improvements. thanks to j.werle!