reorganized files, redid and simplified require function