Fixed the names of the functions to agree with what most people would probably expect, also added comments