split things in files and add more functions