Refactoring, added list indexing.