Some refactoring. Does not work.