Cleaned up the code. A lot of import commands changed and while code has been tested, there might be a break.