added z plus some tweaks