Removed unused imports from previous experiments.
Removed lots of unnecessary casting due to me not knowing how to use templates
Removed lots of unnecessary casting due to me not knowing how to use templates, and a couple of other bug fixes
Small bug fixes and removing unused imports.