change the order of logs
revisited, correct some minor mistakes