Small refactoring. Bug with references left for later.