Move code for simplicity
FIx test case