Added errors logging and emailing to admin