Clean up of old code. Add magic headers