Move class definitions into lib/