home.js unit testing and fixing

code made neater, lot of unit testing, lots of comments,
walletmanager changed a little