initial rifle work, made image access type-safe