Initial implementation of billing algorithm