More flexible tempo handling, new midi file, cleanup and documentation.