Adding some functions
Merging with UI