Improved photometric redshifts via enhanced estimates of system response, galaxy templates and magnitude priors