single threaded version
todo removed