moved code to proper location