Moved stuff from Process to separate functions