added APIHandler class

and other random stuff