Formatting and cleanup code