switched var/pow variables and moved error message.