Added new versions which support an infinite grid
Added functional implementation