Fixed email bug and tightened up some stuff