Finishing up main functionality