Cleaned my code by merging my code with piyushs code