Fixed parsing and added logging