added some comments and tests