New functions written and comments added

Operation of functions tested and confirmed.