Simplified the code in component, and fixed some event actions.

References #693.