formatting and calculations