Removed setTimeout wrapper.
Corrected execution order.