Lots of fixes, also added re, math, random and unittest libraries