Refactor pm.rb and project.rb