Resolved some issues and added logging