Improvment of code to work better.