Add testcase and some implemets