code needed some previously unassigned functions to work