Fix bug : Add boundary handling in getCurrentItem() .

1. Add boundary handling in getCurrentItem() .
2. Refactoring.