Several bugs are fixed, tested to work with at least 9 points!
Margin parameter added