Test fix and some beautify changes