Refactoring

Split calculation method code into different methods