added domain code 0 check
add comment for better code