Several improvements in logging and parsing