Fixed a bug with the methods to set the names

Had to switch the initial if statements. This git commit includes the
javadoc for both this and the previous commit