Extended code for non-Markovian problem setting.