move functions to proper locations