vaguely more working, now the problem is the sqrt, wtf math functions?