Changed thread to use a runnable.