added more idiomatic module.exports, also added check for undefined username/passwrod