cleaned up coe code a bit