huge restructure
fixed a bad import