refactored by M. vol2