Refactored calculations into library.art and library.tb
Fixed two code style issues detected by IntelliJ