commit on thomas@tesla, some modifies and code formats