Make code more Swift-style

Made code a bit more idiomatic in Swift-way.