Added clean up and few more changes to make it work