Add ARC support and some refactoring stuff