Updated to final swift syntax. Other minor improvements.