FIX #97, and refactored