Beautify and bugfix