update code: test cases added and module structure refine