Optimized some general code for legibility / speed...