this is a big method, more than 20 lines of code gets hard to maintain in time, is there any possible way to split this?