rearrange code struct and add an higher level wrapper for simpfy the usage