refactor userdb to interface.(fix issue#7)