Add file functional, but needs to be refactored