Improved state switching
Improved edge drawing