Cont'd debugging/fixing #76, not complete yet