Moved more code in