Minor code improvements.
+ removed redundant code