Updated code for functionality

Completed core functionality