backporting changes up to b874cfe65ebbeb0d89305e766d7b62deac6cf3d0. Magic strings need to be removed once again.