added unit testing, created js functions for straight-line booked calculations