Revert "Merge pull request #27 from xnova/master"

due to broken tests, moved the changes to branch hd-testnet-support

This reverts commit a4ba59e9bacd27191d59959793f8b67eade987c2, reversing
changes made to 36d3d6ebaaa0f99a35c8e0bba765037e006efbc9.
squashed commits from #27