removed redundant functions, and made missing functions
removed redundant functions, and added definitions