cleaned up dp slightly