added teh rest of the functionality