Started moving functionality to classes in lib dir