Adds a last_block api endpoint and refactors the last_block command slightly