Adding new function and a few other changes