Refactoring to support more versatility.