Moved functions arount a bit.