Finished function 4. Found and fixed a bug in Function 3 by changing substr to charAt in multiple locations.