Made the script much more simple. D2L handles session extension already.