Add 6d facedir support and code tidy