Refactor PieSlice class into functions

Dear god I need some unit tests