some problems remain after examination, indenting fixed