Adding the main functionality