minor adjustments, margins and simplifying some code