added local memory implementation.