a quick attempt to clean up this mess...