Move function to proper file