hotfix and refactored