much cleaner code, added a new folder just for functions + internal stuff