From scratch, using structs and funcs.