optimization file and some plotting functions excluded