Improved my code