First version to be refactored.