All functions working, no memory leaks. Still need to comment.