refactored and added format assertion statements