Implementation of my Solution.