refactored to support folder structure