Update to Actions

Added If, Else, While, and Repeat functionality. Made actions smaller by
creating two new functions (handleCondition and doScript). Some variable
renamings.