Cleaned up IMC code