style changes and code cleaning