Refactor and cleanup of Monero code.