Tried to get rid of Components deprecated warnings by requiring components rather than using the global variable
Added logging and debugging