Added email confirmation (untested) and fixed a db bug