remove tabs, improve casts and alignments