added logging, fixed broken form