added resource timings; other refactorings.