extentes badly calculated fixed & added the #ifndef to plot