Updated code to be swifter.

None of the changes should change the behavior of the code only make the code simpler.