adding lib2 folder with rewriting the code to do the task. Trying to reduce the code to do the task