finished writing functions, but very buggy
finished writing functions, but very buggy