Tweaking of algorithm, bugfix on frontend