Improved my answer slightly