minor changes
Rolled back some refactoring due to runtime errors