Completed functions according to assignment