Initial functions programming and updated/improved comments.