Fixed code to keep presents in the viewport