Updated to ensure limits and view state boundaries