Slight refactoring of code base.