improve preserve function
add function to format ([{ in ruby