Arrange codes and replace UIKit by Foundation.