why is this split into 2 functions?