Code rewamped to make sure that headers are not included more than once