Functions cleanup and minor fixes
Styling changes