Added address encoding and generation