cleaned up per James' suggestions