Improved code to shorter