Refactoring the component code to clean it up a bit.