Commented all functions, implemented most of the basic functions