Moved parsing of folder names to it's own function