Clean duplicates and add new functions

Some cleaning for duplicate functions and added few new.