reformat codes
fix density initialization