Changes a foot

Major changes to the functions