Recoded the Composit logic