fixed mima related issues. and general cleanup.