Optimized timer scheduling

A rewritten timer scheduling that uses a heap instead of the naïve list based implementation.

This solves #14 (and #15 because the timer triggering and cancelling are now synchronized).