first version. possibly hideous api in the works.