Refactored the code. The get_account call works. Rest all still need to be tested.