Functions appear functional, but are nto yet commented.
Final version