Cleaned up delegate code