Fixed native detection and cleaned up code a bit
Fixed head