added more logging and separated wp mkdir function