Fixed detect and improved compile a lot I think.