points transfer code moved to function