Completely revamped code structure and functions

Added extensive commenting, and completely reworked the user defined functions system, and now split up functions into smaller functions, in order to make everything more modular. 

Added more comments.

Reworked clear screen, and made it into a function.