Updated, Not Yet tested, It will work after writing unit tests