cleaned up part ii