Document contains codes,tests

Complete codes and test and some explanation in the markdown file.