Made processing of first element of sequence explicit, to avoid null assignment.

Signed-off-by: Stefan Marr <git@stefan-marr.de>
Made `determineContext()` nicer and avoid unnecessary assignments

Signed-off-by: Stefan Marr <git@stefan-marr.de>