-fixed formating and small optimizations