added refered_by field (plus other beatiful changes)