class rewrite, advanced classes now work
merge