code further cleaned up