this is duplicate. We should abstract this into a function to save code.