remove code duplication + create target folder + fixed mispelling