Completed the functions in UI