Think it's better to remove getContentsOfDirectory and use opendir instead inside the class.