refactor into new packages functional, krhashmap, graphenvironment