beautify this code?