Partially refactoring done