Fixes and improvements after refactoring.