Refactored and finished the Action handling.