Working Code(verified)

Try to get a more understanding onto this.