created solve / cache function and some test code, needs to be refined