Function Improved!

fixed corrected “error” function and improved all other functions.
Also, replaced echo with return.