replacevariables, simple predicament class, minor changes. this commit is broken