Added comments to the existing functions, and added a new testfunction