More work converting to php