improve that piece of code