Cleaned up some of the import statements.
Reworked the code to handle missing data.