updated for new swift language features