This commit removes all of the chroot refactor to a seperate file. This paves the way to use these functions in all other scripts.