tweaked y error function
setup for production