refactor and involve files for building gem