code cleanup and file consolidation