Added timer lib, robust interrupt code