Add index decoding
Change signatures to more proper error nesting/catching