Add option to set domain name
Improve code formatting