begins building logic