add proper header file
add back-end segment switch