Added timer and external interrupt functions