separate out getting and incrementing chunk handle
add function declarations for needed functions