Fixed some memory

Added loops for automatic time measurement