functions and fixes