Refactored for Swift beta 4 compatibility

Added access modifiers too.