Additions of Tests, Comment and Minor Alterations to the code.