added alert field and protection against empty fields