added brents changes. WIP