removed some repetitions from addpath function