moved timer calls outside of loop, added some compiler specific options