code formatting and minor adaptations