Added null check for lastPostition
Removed Other changes to prepare for pull request