Better compilation (closes #224)

Based on feedback from @jjallaire