Minimal refactoring of component handler
Cleaning code up a bit
Better printing in component handler