Functionality

Integrated the main functionality