Refactoring login
 #829 - adds dispense medication form smoke test.

Reformated a bunch of code. Look at it with diff -w to ignore whitespace
changes.