Major refactoring to fix drag issues