Improved selector detection and code clean up v0.9.1