added sorting and formatting files
added flushes
fixed styling issues