Fixed a string trim bug (reported by Krystal).

Also, cleaned up the JavaDoc a little bit and renamed a method.