Performance fixes #3