canibalized older code added for basic functionality