refactor userdb to interface.(fix issue#7)

tested on local machine.