Added prelude, more re-factoring