Split functions up into files, started working with struct filedir.