Updated with more stable technique