Core loop using time in milliseconds