more fixing and cleanup