consolidated and cleaned up