Simplify available_time. Use just one temporary variable (this could be removed) later, remove all log and pow calls, use short-circuit evaluation.