refactor and added version