Added logging
Fixed compile errors
Fixed compile errors