Some refactoring. Rename elements so that they are easier to understand.