split this method into few small methods