Added support for RUN

Improved/refactored FUNCTION