Moved code to proper file