refactor to make it integrable for other projects