Some refactoring -> moved some code.