Code design, major function implementation, function test cases