Base version to be heavily refactored.