Move variables declarations near from their usages
ADT_DEV_MODE automatically changes HOST and PORT
Move all functions in a dedicated script