refactor class structure and add documentation in README