cleaned up code - preparing to integrate with dakota driver