Improve and change the code