code formatting and some stability