added grid decoder with tests, fixed horrible aliasing bug