Refactoring: Removed layoutIndex. A layout algorithm object is passed directly instead (IoC).