Refactor block uploader thread module for better thread safety and code reading