Making it work without additional thread