modified binary
organize the codes