reorganized some code
added WalletFile locking for file access, still not fully tested