Moved timer over to c code