Separated api classes into its own library. Added tests