Separate get-position-counts function