Code cleanup and organization
fix for filename changes
Tests for this code