Added functions, renamed some things