cleaned up. dislike the api though.