Changed flags to m instead of -, added .join and .part, remove if statements checking for flags.