Fixed several bugs with missing imports and changed variable names