Refactored pie js and lcap to make the code more universally usable.