Completed the functionality