Add dimensions to filename and actually use the dir variable