cleaned up imports, consolidated code