Updated code to reflect new modular approach.