Moved the blocking code to the run method.