My theme did not have those folders so I moved the code to the location you described and it worked perfectly. I did this in the buddypress folder.
Without confusing things, should I have those folders and file within my theme folder instead? I don’t want to have other issues down the road if this is really needed.