changed up the code to greatly reduce lag, still needs some work