Several code enhancements

contains general performance improvements
Removing of pointless statements
Finalize some fields

will squash if reviewed. I figured it would be easier to review the single commits.