Edited Solution. Added Example