main functionality done