minor changes and debugging