Changed formatting and added logging