Started consolidating some duplicate code