Change username and password variable names

Add trunate method and fix some whitespace.