moved cog code bak