Major refactor - better organization.