Check for INDEX_NAME
Fix empty host or port condition
Restructure constructure ordering