Cleaned up code. Minor interface improvements.