Several bugs have been fixed. Changed to new Swift syntax.