Middle level implementation part1

close #31