Detection seems to work, need improvements too