Refactorint - this is doPost handles errors now