Speed improvements (see #42)