Add z to the mix and some function additions