Second Attempt

A few bug fixes