Added folder creation functionality. Changes code to be more generalized and concise