BUGFIX: Create functions to calculate credits
issue 8