Fixed most of the warnings. The rest will be fixed as we go (fixed #80).