Improved the function and code organization by moving this into the component logic initalization.

Author: Long Nguyen Duc Hoang <lhnguyenduc@wpi.edu>