Moved code; minor renames