Code reduction and clarity fixes