added functions-class and updated (hopefully) all files to use it. (#43)