Turned fit into a fold (still not working) and removed unused functions.