Used inheritance to remove redundancy and unified hooks.