reorganise control flow
start enclosure function
simplify IPV6 checking.
refer back
test