Refactor android networking code.