Fixed compilation and added headers