Fixed bugs with previously tested functions and fixed and tested the rest of the functions. Should all be working now.