Arch refactor

Fixed bugs and added testnet support