gen counter chains and further clean up