Made refactoring on procedures