Fix performance issues and add pause state