clean up user/pass code and add test