add first/second half logic