Moved code to files