Note by Philipp: This file was taken from the simple-rtm repository and has some minor modifications so it doesn't give byte-compilation warnings.