Moved more code out of help functions