put functions in logical place