There's a lot of duplication with setting the path. Can you contain that in one method which you call separately? Maybe pass them the type and options :)