completed rudimentary functions + basic threading