Refactored. Implemented generic getNextBus API helper function.

Updated make & update charts to minimize duplicate code.