First and Complete code commit

Contains the functions as required