Further refactoring of shaft.